<template>
	<view class="login">
		<view class="container">
			<!--顶部返回按钮-->
			<!-- <text class="back-btn iconfont iconzuo" @tap="navBack"></text> -->
			<!--插画-->
			<view class="right-top-sign">
				<image style="width: 100%; height: 300rpx;"
					src="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/3410683c2e1a9e1cffd86375da3fd8c1fd0f232c.png"
					mode="scaleToFill" />
			</view>
			
			<view class="wrapper">
				<!-- <view class="left-top-sign">
					<image class="img_s"
						src="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/3b21f0cca18643e1ab7a6c36cf21376840508399.png"
						mode="scaleToFill" />
				</view> -->
				<!-- <view class="welcome">
					欢迎回来！
				</view> -->
				<view class="input-content">

					<view class="input-item">
						<input type="number" name="mobile" placeholder="请输入手机号" maxlength="11" v-model="mobiles" />
					</view>
					<!-- <view class="input-item">
						<input name="password" type="password" placeholder="请输入密码" maxlength="20" v-model="passwords" />
					</view> -->



				</view>

				<button class="confirm-btn" shape="circle" @click="denglu()">
					提交
				</button>
			</view>
			<view class="right-top-signw">
				<image style="width: 100%; height: 300rpx;"
					src="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/274f070341df6caaab84cc853c133edfaf49adfb.png"
					mode="scaleToFill" />
			</view>
		</view>
		<u-popup @touchmove.stop :show="showInfo" @close="closeInfo" closeOnClickOverlay mode="bottom" round="15">
			<view class="store-popup">
				<view class="title flex-between">
					<text>免责说明协议</text>
					<u-icon @click="closeInfo" name="close-circle-fill" color="#dde3e8" size="18"></u-icon>
				</view>
				<view class="list-2" style="width: 100%; max-height: 60vh; padding: 0 20rpx 0 20rpx">
					<u-parse :content="ticketData.content"></u-parse>
				</view>
			</view>
		</u-popup>
		<view class="popup_s" v-if="popup_s" @click="popup_list"></view>
		<view class="popup_info" v-if="popup_s">
			<view style="width: 100%;height: 80rpx;position: relative;top: 0;left: 0;">
				<view style="position: absolute;top: 10rpx;left: 0;color: #fa4c4c;">
					选择场管
				</view>
				<view style="position: absolute;top: 0;right: 0;font-size: 42rpx;color: #fa4c4c;" @click="popup_clo">
					×
				</view>
			</view>
			<scroll-view scroll-y class="popup_info_ten">
				<!-- <view v-for="(item,index) in user" :key="index" class="popup_name" @click="popup_name(item)">
					{{item.entry_name}}
				</view> -->
				<view v-for="(item,index) in user" :key="index" class="popup_name" @click="popup_name(item)">
					<view>
						{{item.salevenue}}
					</view>
					<view class="">
						{{item.start_time}}
					</view>
					<view class="">
						{{item.end_time}}
					</view>
					<view class="">
						{{item.court_no}}
					</view>
				</view>
			</scroll-view class="table" scroll-y style="height: 1100rpx;;">

		</view>
		<view class="popup_s" v-if="popup_p" @click="popup_ps"></view>
		<view class="popup_p" v-if="popup_p">
			<view style="width: 100%;height: 80rpx;position: relative;top: 0;left: 0;">
				<view style="position: absolute;top: 10rpx;left: 0;color: #fa4c4c;">
					选择场管
				</view>
				<view style="position: absolute;top: 0;right: 0;font-size: 42rpx;color: #fa4c4c;" @click="popup_cp">
					×
				</view>
			</view>
			<scroll-view scroll-y class="popup_info_ten">
				<!-- <view v-for="(item,index) in user" :key="index" class="popup_name" @click="popup_name(item)">
					{{item.entry_name}}
				</view> -->
				<view v-for="(it,index) in user_p" :key="index" class="popup_name" @click="popup_names(it)">
					<view class="popup_name_ps">
						{{it.order_id}}
					</view>
					<view class="popup_name_p">
						{{it.create_at}}
					</view>


				</view>
			</scroll-view class="table" scroll-y style="height: 1100rpx;;">

		</view>
		
	</view>
</template>
<script>
	const index = require("@/api/index/index.js");
	export default {

		data() {
			return {
				mobiles: '',
				passwords: '',
				project_id: '',
				popup_s: false,
				popup_p: false,
				user: [],
				project_id: '',
				court_id: '',
				id: '',
				payWaitTime: '00:15:00',
				user_p: [],
				query:'',
				q:"",
				qs:{}
			};
		},
		onLoad(query) {
		 //    const q = decodeURIComponent(query.court_id) // 获取到二维码原始链接内容
		 //    const scancode_time = parseInt(query.scancode_time) // 获取用户扫码时间 UNIX 时间戳
			// this.q = decodeURIComponent(query.q)
			// this.qs = query
			// this.query = query
			// console.log(query,'123')
			// console.log(q,'456')
			// console.log(scancode_time,'789')
		  },
		methods: {

			// 登录
			async getPrice() {
				let that = this;
				let data = {
					project_id: getApp().globalData.projectId,
					app_id: this.$https.weixinAppId,
					phone: this.mobiles,
					court_id: this.court_id,
					chosen_id: this.id,
				};
				let result = await index.getPrice(data);
				if (result.code == 1) {
					if (uni.getStorageSync("buy_success_id") != '' && uni.getStorageSync("buy_success_id") !=
						null && uni.getStorageSync("buy_success_id") != undefined) {
						uni.requestSubscribeMessage({
							tmplIds: [uni.getStorageSync("buy_success_id")],
							success(ru) {
								uni.navigateTo({
									url: "/page_venues/pages/venuesDetail/pay/pay?amount=" +
										result.data.data.goods_price + "&order_id=" +
										result.data.data.order_no +
										"&orderid=" +
										result.data.data.order_number +
										"&order_type=" +
										result.data.data.order_type + "&venue_id=" +
										result.data.data.venue_id + "&typetime=" + 1 +
											"&goods_id=" +
											result.data.data.id,
								});
							}
						})
					} else {
						uni.navigateTo({
							url: "/page_venues/pages/venuesDetail/pay/pay?amount=" +
								result.data.data.goods_price + "&order_id=" +
								result.data.data.order_no +
								"&orderid=" +
								result.data.data.order_number +
								"&order_type=" +
								result.data.data.order_type + "&venue_id=" +
								result.data.data.venue_id + "&typetime=" + 1 +
											"&goods_id=" +
											result.data.data.id,
						});
					}
					// uni.requestSubscribeMessage({
					// 	tmplIds: ['LVTnQXVNAhpWlg6HdmMWDL0LyVw6t19Gjn96ScI58fU'],
					// 	success(ru) {
					// 		uni.navigateTo({
					// 			url: "/page_venues/pages/venuesDetail/pay/pay?amount=" +
					// 				result.data.data.goods_price + "&order_id=" +
					// 				result.data.data.order_no +
					// 				"&orderid=" +
					// 				result.data.data.order_number +
					// 				"&order_type=" +
					// 				result.data.data.order_type + "&venue_id=" +
					// 				result.data.data.venue_id + "&typetime=" + 1,
					// 		});
					// 	}
					// })
				}
			},
			popup_list() {
				this.popup_s = false
			},
			popup_ps() {
				this.popup_p = false
			},
			popup_name(item) {
				this.project_id = item.project_id
				this.popup_s = false
				this.getPrice()

			},
			popup_names(it) {
				this.popup_p = false
				uni.requestSubscribeMessage({
					tmplIds: ['LVTnQXVNAhpWlg6HdmMWDL0LyVw6t19Gjn96ScI58fU'],
					success(ru) {
						uni.navigateTo({
							url: "/page_venues/pages/venuesDetail/pay/pay?amount=" +
								it.amount_payable + "&order_id=" +
								it.order_id +
								"&orderid=" +
								it.id +
								"&order_type=" +
								it.order_type + "&venue_id=" +
								it.venue_id + "&typetime=" + 1,
						});
					}
				})
			},
			async denglu() {
				let that = this;
				let data = {
					app_id: this.$https.weixinAppId,
					project_id: getApp().globalData.projectId,
					phone: this.mobiles,
				};
				index.checkNoPayOrder(data).then(res => {
					if (res.data.size > 0) {
						that.popup_p = true
						that.user_p = res.data.result
					} else {
						index.getCourtInfo(data).then(result => {
							if (result.code == 1) {
								that.popup_s = true
								that.user = result.data.result
								that.court_id = result.data.result[0].court_id
								that.id = result.data.result[0].id

							} else {
								uni.showToast({
									title: result.info,
									icon: 'none',
									duration: 2000
								})
								that.popup_s = false
							}
						})
					}


				})

			},
			popup_clo() {
				this.popup_s = false
			},
			popup_cp() {
				this.popup_p = false
			},

		}
	}
</script>
<style lang="scss">
	.container {
		position: relative;
		width: 100vw;
		height: 100vh;
		overflow: hidden;
		background: #fff;

		.wrapper {
			position: relative;
			z-index: 90;
			margin-top: 56%;



			.confirm-btn {
				width: 90%;
				height: 80rpx;
				line-height: 80rpx;
				background-color: rgb(255, 101, 85);
				border-radius: 40rpx;
				text-align: center;
				color: #fff;
				float: inherit;
				margin: 50rpx 38rpx 25rpx 38rpx;

			}
		}

		.back-btn {
			position: absolute;
			left: 40rpx;
			z-index: 9999;
			top: 40rpx;
			font-size: 40rpx;
		}

		.left-top-sign {
			width: 100%;
			height: 250rpx;
			text-align: center;

			.img_s {
				vertical-align: middle;
				width: 240rpx;
				height: 200rpx;
			}
		}

		.right-top-sign {
			width: 100%;
			height: 300rpx;
			position: absolute;
			top: 0;
			z-index: 999;
		}

		.right-top-signw {
			position: absolute;
			width: 100%;
			height: 300rpx;
			bottom: 0;
			z-index: 999;

		}

		.left-bottom-sign {
			position: absolute;
			left: -270rpx;
			bottom: -320rpx;
			border: 100rpx solid #d0d1fd;
			border-radius: 50%;
			padding: 180rpx;
		}

		.welcome {
			position: relative;
			left: 50rpx;
			top: -90rpx;
			font-size: 46rpx;
			color: #555;
			text-shadow: 1px 0px 1px rgba(0, 0, 0, 0.3);
		}

		.input-content {
			padding: 0 60rpx;

		}

		.input-item {
			display: flex;
			flex-direction: column;
			align-items: flex-start;
			justify-content: center;
			padding: 0 30rpx;
			height: 100rpx;
			border-radius: 4px;
			margin-bottom: 20rpx;
			background-color: #F0F3F7;
			border-radius: 60rpx 60rpx;

			&:last-child {
				margin-bottom: 0;
			}

			.tit {
				height: 50rpx;
				line-height: 56rpx;
			}

			input {
				height: 60rpx;
				width: 90%;
				margin-left: 30rpx;
				font-size: 30rpx;
			}
		}

		.input-item-sms-code {
			position: relative;
			width: 100%;

			.sms-code-btn {
				position: absolute;
				color: #111;
				right: 20rpx;
				bottom: 20rpx;
				font-size: 28rpx;
			}

			.sms-code-resend {
				color: #999;
			}

			.sms-code-btn:after {
				border: none;
				background-color: transparent;
			}
		}

		.forget-section {
			text-align: center;
			margin-top: 40rpx;
		}

		.register-section {
			margin: 20rpx 0 50rpx 0;
			width: 100%;
			text-align: center;

			text {
				margin-left: 10rpx;
				font-size: 26rpx;
				color: #999;
			}

			text:first-child {
				margin-right: 10rpx;
			}
		}

		.btn-group {
			display: flex;
			margin-bottom: 20rpx;
		}
	}

	.popup_s {
		position: fixed;
		left: 0;
		right: 0;
		top: 0;
		width: 100vw;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.8);
		z-index: 9998;
	}

	.popup_info {
		position: fixed;
		width: 530rpx;
		height: 743rpx;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		font-size: 26rpx;
		padding: 40rpx;
		overflow: hidden;
		background-image: url('https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/e89844bfef73c699ef06622d923147613e4585af.png');
		background-repeat: no-repeat;
		z-index: 9999;
		background-size: 100% 100%;

		.popup_info_ten {
			width: 100%;
			height: 400rpx;
			margin-top: 120rpx;

			.popup_name {
				width: 100%;
				height: 160rpx;
				background-color: #f8f8f8;
				margin-top: 10rpx;
				line-height: 40rpx;
				text-align: center;

			}
		}

	}

	.popup_p {
		position: fixed;
		width: 530rpx;
		height: 743rpx;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		font-size: 26rpx;
		padding: 40rpx;
		overflow: hidden;
		background-image: url('https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/e89844bfef73c699ef06622d923147613e4585af.png');
		background-repeat: no-repeat;
		z-index: 9999;
		background-size: 100% 100%;

		.popup_info_ten {
			width: 100%;
			height: 400rpx;
			margin-top: 120rpx;

			.popup_name {
				width: 100%;
				height: 100rpx;
				background-color: #f8f8f8;
				margin-top: 10rpx;
				line-height: 40rpx;
				text-align: center;

				.popup_name_ps {
					width: 100%;
					height: 55rpx;
					line-height: 55rpx;
				}

				.popup_name_p {
					width: 100%;
					height: 40rpx;
					line-height: 40rpx;
				}

			}
		}

	}

	.login-type-2 {
		width: 100%;
		position: relative;

		.back-btn {
			position: absolute;
			left: 40rpx;
			z-index: 9999;
			top: 40rpx;
			font-size: 48rpx;
		}

		.login-top {
			height: 460rpx;
			position: relative;

			.desc {
				position: absolute;
				top: 200rpx;
				left: 40rpx;
				font-size: 48rpx;

				.title {
					font-size: 48rpx;
				}
			}

			.login-pic {
				position: absolute;
				width: 220rpx;
				height: 270rpx;
				right: 30rpx;
				top: 100rpx;
			}
		}

		.login-type-content {
			position: relative;
			top: -72rpx;

			.login-bg {
				width: 94vw;
				height: 94vw;
				margin: 0 3vw;
			}

			.main {
				width: 94vw;
				position: absolute;
				top: 0;
				left: 3vw;

				.nav-bar {
					display: flex;
					height: 100rpx;
					justify-content: center;
					align-items: center;
					position: relative;
					z-index: 10;

					.nav-bar-item {
						flex: 1;
						display: flex;
						height: 100%;
						line-height: 96rpx;
						display: flex;
						margin: 0 120rpx;
						justify-content: center;
					}

					.nav-bar-item-active {
						border-bottom: 5rpx solid;
					}
				}

				.login-type-form {
					width: 80%;
					margin: 50rpx auto;

					.input-item {
						position: relative;
						height: 90rpx;
						line-height: 90rpx;

						.iconfont {
							font-size: 50rpx;
							position: absolute;
							left: 0;
						}

						.login-type-input {
							height: 90rpx;
							padding-left: 80rpx;
							border-bottom: 1rpx solid rgba(0, 0, 0, .1);
						}

						.sms-code-btn,
						sms-code-resend {
							width: 240rpx;
						}
					}
				}

				.login-type-tips {
					padding: 0 50rpx;
					display: flex;
					justify-content: space-between;
				}


			}
		}

		.login-type-bottom {
			width: 100%;
			padding-bottom: 30rpx;
			text-align: center;
		}
	}
</style>
